package InterfaceOffer;

public class Practice2 {
    public static void main(String[] args) {
        int i = primePalindrome(6);
        System.out.println(i);
    }
    public static int primePalindrome(int n) {
        if(n < 2)
            return 2;
        while(true){
            if(isPure(n) && ishuiwen(n))
                return n;
            n++;
        }
    }
    public static boolean isPure(int n){
        for(int i = 2 ; i < n ; i++){
            if(n%i == 0)
                return false;
        }
        return true;
    }
    public static boolean ishuiwen(int n){
        int m = 0;
        int oldN = n;
        while(n!=0){
            m = m*10+n%10;
            n/=10;
        }
        if(m==oldN)
            return true;
        return false;
    }
}
